package com.ndp.fb.rdb.model;

import com.ndp.fb.rdb.annotation.NoSave;
import com.ndp.fb.rdb.annotation.Table;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.Calendar;
import java.util.TimeZone;

/**
 * Created by mikey.zhaopeng on 2015/6/3.
 * 对 EntrustAccount 扩展,增加一些属性
 */
@Setter
@Getter
@NoArgsConstructor
//只查询,保存使用的是entrust_account保存
@Table("entrust_account")
public class EntrustAccountExt extends EntrustAccount {
    private static final long serialVersionUID = -2006313215406404877L;
    //fb_user_id
    @NoSave
    private Long fbUserId;
    //fb_userpermissions_adaccounts.role
    @NoSave
    private String role;
    //fb_userpermissions_adaccounts.`status`
    @NoSave
    private String status;
    @NoSave
    private int timezoneOffset;
    //fb_userpermissions_adaccounts.fb_business_id
    @NoSave
    private Long fbBusinessId;
    public void setTimezone(String timezone) {
        super.setTimezone(timezone);
        int offset = Calendar.getInstance(TimeZone.getTimeZone(timezone)).get(Calendar.ZONE_OFFSET) / 1000 / 60 / 60;
        this.setTimezoneOffset(offset);
    }

}
